import java.util.LinkedList;

public class Engine
{
	

	public void Mim(SearchStrategy usedStrategy, boolean visualize)
	{
				// defining operators and adding them in a Linked list
				LinkedList<String> operators = new LinkedList<String>();
				operators.add("Up");	operators.add("Down");
				operators.add("Left");	operators.add("Right");
				
				// creating the initial state
				Board initialBoard = new Board();
				initialBoard.createBoard();
				initialBoard.printBoard();
				State initialState = new State(initialBoard);
				
				// initializing the goalTest
				boolean goalTest = false;
				
				// initialize the path cost
				int pathCost = 0;
				
				//initialize the problem
				Problem myProblem = new Problem (operators,initialState,goalTest,pathCost);
				
				// initialize the generic search 
				GenericSearch generalSearch = new GenericSearch(myProblem, usedStrategy);
				
				Node solution =generalSearch.gnSearch();
				
				if(solution !=null)
				{
					// printing Solution
					//printSequenceOfMoves(solution);
				}
				else
				{
					System.out.println("Sorry there is no solution found");
				}
					
	}
	public void printSequenceOfMoves(Node solution)
	{
		LinkedList<String> seq = solution.getMovementsSoFar();
		System.out.print(" The Sequence to the solution : ");
		while(!seq.isEmpty())
		{
			System.out.print(seq.pop() +" , ");
		}
	}

	public static void main(String[] args)
	{
		Engine engine = new Engine();
		
		// choose the startegy used 
		SearchStrategy usedStrategy = new SearchStrategy("BF");		
		
		engine.Mim(usedStrategy, true);
	}

}
